import PaginationDto from "apps/admin/src/dtos/pagination.dto";
import { IsBoolean, IsNotEmpty, IsNumber, IsOptional, IsString, Max, MaxLength, Min } from "class-validator";

class CommonDto {
    @MaxLength(30)
    @IsNotEmpty()
    @IsString()
    name:string;

    @MaxLength(30)
    @IsNotEmpty()
    @IsString()
    code:string;

    @Min(0)
    @IsNumber()
    @IsOptional()
    sort:number;

    @IsBoolean()
    @IsOptional()
    enable:boolean;
}

export class AddDto extends CommonDto {
    @IsOptional()
    createTime : number
}

export class EditDto extends CommonDto {
    @IsOptional()
    updateTime : number
}

export class PageDto extends PaginationDto {
    @MaxLength(30)
    @IsNotEmpty()
    @IsString()
    name:string;

    @MaxLength(30)
    @IsNotEmpty()
    @IsString()
    code:string;
}